package com.sds.sweng.swat.miplatform.service.validation;

import java.math.BigDecimal;

import org.apache.commons.lang.StringUtils;

public class ValidationProperty {
	private String[] keys;
	private Object value;

	public ValidationProperty(String[] keys, Object value) {
		this.keys = keys;
		this.value = value;
	}

	public String getKey(int language) {
		return keys[language];
	}

	public String getStringValue() {
		if (value instanceof String) {
			return String.valueOf(value);
		} else if (value instanceof BigDecimal) {
			if (value == null) {
				return StringUtils.EMPTY;
			} else {
				return ((BigDecimal) value).toString();
			}
		} else if (value instanceof Boolean) {
			if (value == null) {
				return "false";
			} else {
				return String.valueOf(value);
			}
		} else {
			if (value == null) {
				return StringUtils.EMPTY;
			} else {
				return String.valueOf(value);
			}
		}
	}

}
